<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    var test = 20;
    test = "张三"
    //document.write(test);
    /**
     * var
     * 1. 作用域：全局变量
     * 2. 变量可以重复定义
     */
    {
        var age = 30;
        var age = 20;
        let age2 = 45;
        let id = 99;
        const PI = 3.14;
        //document.write(PI);
    }
    //输出20
    //document.write(age);
    //报错
    //document.write(id);
    //document.write(PI)
</script>
</body>
</html>